<%@taglib uri="http://www.springframework.org/tags/form" prefix="form"%>
<%@page import="java.util.List,java.util.Iterator,com.crm.entity.Business" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<link href="<%=application.getContextPath() %>/css/css-crm.css" rel="stylesheet" type="text/css" />
<script  type="text/javascript" src="<%=application.getContextPath()%>/js/jquery-1.6.min.js"></script> 
<script type="text/javascript">
$('#name').change(function() {
var data=$('#name').val();
$.ajax({
	url:"<%=application.getContextPath()%>/company/search.do" ,
  	data:"compname="+data,
  	success:function(res){
  		$('#savediv').remove();
  		$("#content").append('<div class="box" id="editres"></div> ');
  		$('#editres').html(res);
		
  	}
  });
});
function validate(){
	var name=$("#name").val();
	var tin=$("#tinno").val();
	var cst=$("#cstNo").val();
	var pan=$("#panNo").val();
	var fax=$("#fax").val();
	var email=$("#email").val();
	var micr=$("#micr").val();
	var address=$("#address").val();
	var phone=$("#phoneNo").val();
	var shortName=$("#shortName").val();
	var ifsc=$("#ifsc").val();
	var accNo=$("#accNo").val();
	var tAndC=$("#tAndC").val();
	var emailFormat = /^([A-Za-z0-9_\-\.])+\@([A-Za-z0-9_\-\.])+\.([A-Za-z]{2,4})$/;
	var panFormat =/^([a-zA-Z]){5}([0-9]){4}([a-zA-Z]){1}?$/;
	if(name==null || name==""){
		alert("Please Enter Company Name");
		$("#name").focus();
		return false;
	}
	else if(tin==null || tin==""){
		alert("Please Enter TIN Number");
		$("#tinno").focus();
		return false;
	}
	else if(cst==null || cst==""){
		alert("Please Enter CST Number");
		$("#cstNo").focus();
		return false;
	}
	else if(pan==null || pan==""){
		alert("Please Enter PAN Number");
		$("#panNo").focus();
		return false;
	}
	else if(panFormat.test(pan) == false) {
	 
	      alert('Invalid PAN Number');
	      $("#panNo").focus();
	      return false;
	   }
	 else if(fax==null || fax==""){
		alert("Please Enter FAX Number");
		$("#fax").focus();
		return false;
	}
	 else if(email==null || email==""){
		alert("Please Enter EMail ID");
		$("#email").focus();
		return false;
	}
	
	else if(emailFormat.test(email) == false) {
	 
	      alert('Invalid Email Address');
	      $("#email").focus();
	      return false;
	   }
	else if(micr==null || micr==""){
		alert("Please Enter MICR Number");
		$("#micr").focus();
		return false;
	}
	else if(address==null || address==""){
		alert("Please Enter Address");
		$("#address").focus();
		return false;
	}
	else if(phone==null || phone==""){
		alert("Please Enter Phone Number");
		$("#phoneNo").focus();
		return false;
	}
	else if(shortName==null || shortName==""){
		alert("Please Enter Short Name");
		$("#shortName").focus();
		return false;
	}
	else if(ifsc==null || ifsc==""){
		alert("Please Enter IFSC Code");
		$("#ifsc").focus();
		return false;
	}
	else if(accNo==null || accNo==""){
		alert("Please Enter Short Name");
		$("#accNo").focus();
		return false;
	}
	else if(tAndC==null || tAndC==""){
		alert("Please Enter Terms And Conditions");
		$("#tAndC").focus();
		return false;
	}
	return true;
}

</script>
</head>
<body>
<div id="main">
 <!--  <div id="header"></div> -->
    <%@ include file="common/header.jsp" %>
  <%@ include file="common/submenu.jsp" %> 
  <div id="content">
  <div id="resultmsg" class="result_msg">
  <%
	if(request.getAttribute("success-msg")!=null){
	String  msg=(String)request.getAttribute("success-msg");
	out.println(msg);
	}
	 %>
  </div>
  <div id="work-area2">
    <div id="savediv">
	<form:form id="companyForm" action="editsave.do" enctype="multipart/form-data" method="post">
    <div class="heading">Company</div>
	  
      <div class="boxIFS" >
        <table width="100%" border="0" cellspacing="0" cellpadding="0">
          <tr>
            <td width="366"><table width="1088" border="0" cellspacing="0" cellpadding="0">
              <tr>
                <td width="44">&nbsp;</td>
                <td width="137">&nbsp;</td>
                <td width="266">&nbsp;</td>
                <td width="41">&nbsp;</td>
                <td width="178">&nbsp;</td>
                <td width="579">&nbsp;</td>
              </tr>
              <tr>
                <td height="28">&nbsp;</td>
                <td align="left" valign="top">Company Name</td>
                <td align="left" valign="top">
                <form:input path="businessId" type="hidden" name="businessId"/>
                <form:input path="businessName" name="editName" type="text" class="form" value="" id="name"/>                </td>
                <td>&nbsp;</td>
                <td align="left" valign="top">MICR No </td>
                <td align="left" valign="top"><form:input path="micr" type="text" name="micr" class="form" value="" id="micr"/></td>
              </tr>
              <tr>
                <td height="5"></td>
                <td height="5" align="left" valign="top"></td>
                <td height="5" align="left" valign="top"></td>
                <td align="left" valign="top"></td>
                <td align="left" valign="top"></td>
                <td align="left" valign="top"></td>
              </tr>
              <tr>
                <td>&nbsp;</td>
                <td align="left" valign="top">TIN No </td>
                <td align="left" valign="top">
                <form:input path="tinno" name="tinNo" type="text" class="form" value="" id="tinno"/></td>
                <td>&nbsp;</td>
                <td align="left" valign="top">Phone Number</td>
                <td align="left" valign="top"><form:input path="phone" name="phone" type="text" class="form" value="" id="phoneNo"/></td>
              </tr>
              <tr>
                <td height="5"></td>
                <td height="5" align="left" valign="top"></td>
                <td height="5" align="left" valign="top"></td>
                <td align="left" valign="top"></td>
                <td align="left" valign="top"></td>
                <td align="left" valign="top"></td>
              </tr>
              <tr>
                <td>&nbsp;</td>
                <td align="left" valign="top">CST No </td>
                <td align="left" valign="top">
                <form:input path="cstno" name="cstNo" type="text" class="form" value="" id="cstNo"/></td>
                <td>&nbsp;</td>
                <td align="left" valign="top">Short Name </td>
                <td align="left" valign="top"><form:input path="shortname" name="shortName" type="text" class="form" value="" id="shortName"/></td>
              </tr>
              <tr>
                <td height="5"></td>
                <td height="5" align="left" valign="top"></td>
                <td height="5" align="left" valign="top"></td>
                <td align="left" valign="top"></td>
                <td align="left" valign="top"></td>
                <td align="left" valign="top"></td>
              </tr>
              <tr>
                <td>&nbsp;</td>
                <td align="left" valign="top">PAN No </td>
                <td align="left" valign="top">
                <form:input path="panno" name="panNo" type="text" class="form" value="" id="panNo"/></td>
                <td>&nbsp;</td>
                <td align="left" valign="top">IFSC Code </td>
                <td align="left" valign="top"><form:input path="ifsc" name="ifsc"  type="text" class="form" value="" id="ifsc"/></td>
              </tr>
              <tr>
                <td height="5"></td>
                <td height="5" align="left" valign="top"></td>
                <td height="5" align="left" valign="top"></td>
                <td align="left" valign="top"></td>
                <td align="left" valign="top"></td>
                <td align="left" valign="top"></td>
              </tr>
              <tr>
                <td>&nbsp;</td>
                <td align="left" valign="top">Fax</td>
                <td align="left" valign="top">
                <form:input path="fax" type="text" name="fax" class="form" value="" id="fax"/></td>
                <td>&nbsp;</td>
                <td>Account No </td>
                <td><form:input path="accno" name="accountNo" type="text" class="form" value="" id="accNo"/></td>
              </tr>
              <tr>
                <td height="5"></td>
                <td height="5" align="left" valign="top"></td>
                <td height="5" align="left" valign="top"></td>
                <td align="left" valign="top"></td>
                <td align="left" valign="top"></td>
                <td align="left" valign="top"></td>
              </tr>
              <tr>
                <td>&nbsp;</td>
                <td align="left" valign="top">Email</td>
                <td align="left" valign="top">
                <form:input path="email" type="text" name="email" class="form-lowercase" value="" id="email"/></td>
                <td align="left" valign="top">&nbsp;</td>
                <td align="left" valign="top">Address</td>
                <td align="left" valign="top"><form:textarea path="address" name="address" class="form-textarea" id="address"/></td>
              </tr>
              <tr>
                <td height="5"></td>
                <td height="5" align="left" valign="top"></td>
                <td height="5" align="left" valign="top"></td>
                <td align="left" valign="top"></td>
                <td align="left" valign="top"></td>
                <td align="left" valign="top"></td>
              </tr>
              <tr>
                <td>&nbsp;</td>
                <td align="left" valign="top">&nbsp;</td>
                <td align="left" valign="top">&nbsp;</td>
                <td align="left" valign="top">&nbsp;</td>
                <td align="left" valign="top">&nbsp;</td>
                <td align="left" valign="top">&nbsp;</td>
              </tr>
              <tr>
                <td height="5"></td>
                <td height="5" align="left" valign="top"></td>
                <td height="5" align="left" valign="top"></td>
                <td align="left" valign="top"></td>
                <td align="left" valign="top"></td>
                <td align="left" valign="top"></td>
              </tr>
              <tr>
                <td>&nbsp;</td>
               <!--  <td align="left" valign="top">Company Logo </td> -->
                <td align="left" valign="top">
             <!--  <input name="logo" type="file" class="form-small" value="" />  -->                  </td>
              </tr>
              <tr>
                <td>&nbsp;</td>
                <td align="left" valign="top">&nbsp;</td>
                <td align="left" valign="top">&nbsp;</td>
                <td align="left" valign="top">&nbsp;</td>
                <td align="left" valign="top">&nbsp;</td>
                <td align="left" valign="top">&nbsp;</td>
              </tr>
              
              <tr>
                <td>&nbsp;</td>
                <td>&nbsp;</td>
                <td>&nbsp;</td>
                <td>&nbsp;</td>
                <td>&nbsp;</td>
                <td>&nbsp;</td>
              </tr>
            </table></td>
            </tr>
        </table>
      </div>
      
	   
	  <div class="box2">
	    <table width="698" border="0" cellspacing="0" cellpadding="0">
          <tr>
            <td width="51">&nbsp;</td>
            <td width="135" align="left" valign="top">Terms &amp; Conditions </td>
            <td width="512">
            <form:textarea path="tandc" name="tAndC" class="form-textarea1" id="tAndC"/></td>
          </tr>
        </table>
	  </div>
	  <div class="box2">
	    <div class="buttton-main">
	    <input class="button" type="reset" value="Clear"/>
	    <input class="button" type="submit" value="Save" /></div>
	    </div>
    </form:form>
    </div>
    </div>
  </div>
  <div id="footer"></div>  
</div>
</body>
</html>

